﻿<?php

include 'header.php';
include 'fun.php';


?>
 <?php
if ($_POST) {
    try {
        if (isset($_POST['name']) & isset($_POST['department']) & isset($_POST['class']) & isset($_POST['college']) & isset($_POST['phone']) & isset($_POST['email'])) {
            $name = $_POST['name'];
        }
        $department = $_POST['department'];
        $class = $_POST['class'];
        $college = $_POST['college'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $introduction = $_POST['introduction'];
        if ($name == "")
            throw new Exception('姓名');
        if ($department == "")
            throw new Exception('部门');
        if ($class == "")
            throw new Exception('年级');
        if ($college == "")
            throw new Exception('学院');
        if ($phone == "")
            throw new Exception('长号或者短号');
        if ($email == "")
            throw new Exception('邮箱');

        $sql = "insert into jianli(name,department,class,college,phone,email,introduction) value
         ('$name','$department','$class','$college','$phone','$email','$introduction')";
        $re = sj($sql);
        if ($re) {
            echo '<script language ="javascript">alert("投放简历成功");
               location.replace("/red/");</script>';
        } 

        else {
            echo '<script language ="javascript">alert("请输入完整的信息");</script>';
        }
    } 

    catch (Exception $e) {
        $a = $e->getMessage();
        echo '<script language ="javascript">alert("请填写完整信息！");</script>';
    }
}

?>

<div id="part">
	<form action="" method="post">
	<div>
		<table id="part" >
			<tr>
				<td >姓名:</td>
				<td ><input name="name" type="text" /></td>
			</tr>
			<tr>
				<td>面试部门:</td>
				<td><input name="department" type="text" /></td>
			</tr>
			<tr>
				<td>年级:</td>
				<td><input name="class" type="text" /></td>
			</tr>
			<tr>
				<td>所在学院:</td>
				<td><input name="college" type="text" /></td>
			</tr>
			<tr>
				<td>电话号码:</td>
				<td><input name="phone" type="text" /></td>
			</tr>
			<tr>
				<td>邮箱:</td>
				<td><input name="email" type="text" /></td>
			</tr>
		</table>
		</div>
		<div>
			简介:
			<textarea name="introduction" rows="6px" cols="45px"></textarea>
		</div>
		<div>
			<input name="submit" type="submit" value="投简历"
				style="width: 100px; height: 60px; font-size: 25px" />
		</div>
	</form>
</div>
</html>
